package com.genexususa.eo.bing.test.update;

import com.genexususa.eo.bing.connection.TargetManager;
import com.genexususa.eo.bing.test.TestUtil;

public class ConsumeUpdateTargetsInLibrary {
    public static void main(String[] args) {
        TestUtil testUtil = new TestUtil();
        String targetsXML = "<Bing_TargetCollection xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                             "\t<Target xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                    "\t\t<Day>\n" +
                                        "\t\t\t<DayTargetBidCollection>\n" +
                                            "\t\t\t\t<DayTargetBid>\n" +
                                                "\t\t\t\t\t<Day>Sunday</Day>\n" +
                                                "\t\t\t\t\t<IncrementalBid>NinetyPercent</IncrementalBid>\n" +
                                            "\t\t\t\t</DayTargetBid>\n" +
                                        "\t\t\t</DayTargetBidCollection>\n" +
                                        "\t\t\t<TargetAllDays>false</TargetAllDays>\n" +
                                    "\t\t</Day>\n" +
                                    "\t\t<Gender>\n" +
                                        "\t\t\t<GenderTargetBidCollection>\n" +
                                            "\t\t\t\t<GenderTargetBid>\n" +
                                                "\t\t\t\t\t<Gender>Female</Gender>\n" +
                                                "\t\t\t\t\t<IncrementalBid>FortyPercent</IncrementalBid>\n" +
                                            "\t\t\t\t</GenderTargetBid>\n" +
                                            "\t\t\t\t<GenderTargetBid>\n" +
                                                "\t\t\t\t\t<Gender>Male</Gender>\n" +
                                                "\t\t\t\t\t<IncrementalBid>TenPercent</IncrementalBid>\n" +
                                            "\t\t\t\t</GenderTargetBid>\n" +
                                        "\t\t\t</GenderTargetBidCollection>\n" +
                                    "\t\t</Gender>\n" +
                                    "\t\t<GxTargetId>16153365213</GxTargetId>\n" +
                                    "\t\t<BingTargetId>" + testUtil.targetId1 + "</BingTargetId>\n" +
                                    "\t\t<Location>\n" +
                                        "\t\t\t<RadiusTarget>\n" +
                                            "\t\t\t\t<RadiusTargetBidCollection>\n" +
                                                "\t\t\t\t\t<RadiusTargetBid>\n" +
                                                    "\t\t\t\t\t\t<IncrementalBid>ZeroPercent</IncrementalBid>\n" +
                                                    "\t\t\t\t\t\t<LatitudeDegrees>-4</LatitudeDegrees>\n" +
                                                    "\t\t\t\t\t\t<LongitudeDegrees>-25.30</LongitudeDegrees>\n" +
                                                    "\t\t\t\t\t\t<Name>New Radius Target Name 4</Name>\n" +
                                                    "\t\t\t\t\t\t<Radius>30</Radius>\n" +
                                                "\t\t\t\t\t</RadiusTargetBid>\n" +
                                            "\t\t\t\t</RadiusTargetBidCollection>\n" +
                                        "\t\t\t</RadiusTarget>\n" +
                                        "\t\t\t<TargetAllLocations>false</TargetAllLocations>\n" +
                                    "\t\t</Location>\n" +
                                    "\t\t<Name>TargetName 1</Name>\n" +
                                "\t</Target>\n" +
                                "\t<Target xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                    "\t\t<Gender>\n" +
                                        "\t\t\t<GenderTargetBidCollection>\n" +
                                            "\t\t\t\t<GenderTargetBid>\n" +
                                                "\t\t\t\t\t<Gender>Male</Gender>\n" +
                                                "\t\t\t\t\t<IncrementalBid>TwentyPercent</IncrementalBid>\n" +
                                            "\t\t\t\t</GenderTargetBid>\n" +
                                        "\t\t\t</GenderTargetBidCollection>\n" +
                                    "\t\t</Gender>\n" +
                                    "\t\t<GxTargetId>16153365213</GxTargetId>\n" +
                                    "\t\t<BingTargetId>" + testUtil.targetId2 + "</BingTargetId>\n" +
                                    "\t\t<Location>\n" +
                                        "\t\t\t<CountryTarget>\n" +
                                            "\t\t\t\t<CountryTargetBidCollection>\n" +
                                                "\t\t\t\t\t<CountryTargetBid>\n" +
                                                    "\t\t\t\t\t\t<CountryAndRegion>UY</CountryAndRegion>\n" +
                                                    "\t\t\t\t\t\t<IncrementalBid>NinetyPercent</IncrementalBid>\n" +
                                                "\t\t\t\t\t</CountryTargetBid>\n" +
                                            "\t\t\t\t</CountryTargetBidCollection>\n" +
                                        "\t\t\t</CountryTarget>\n" +
                                        "\t\t\t<HasPhysicalIntent>false</HasPhysicalIntent>\n" +
                                        "\t\t\t<TargetAllLocations>false</TargetAllLocations>\n" +
                                    "\t\t</Location>\n" +
                                    "\t\t<Name>New TargetName 2</Name>\n" +
                                "\t</Target>\n" +
                            "</Bing_TargetCollection>\n";
        TargetManager resource = new TargetManager();
        System.out.println("Consuming UpdateTargetsInLibrary.....");
        String userName = testUtil.userName;
        String password = testUtil.password;
        String developerToken = testUtil.developerToken;
        long customerId = testUtil.customerId;
        long customerAccountId = testUtil.customerAccountId;
        String applicationId = testUtil.applicationId;
        String result = resource.updateTargetsInLibrary(customerAccountId, targetsXML);
        System.out.println("Result:\n" + result);
    }
}
